Feature: workspace info app extension#18014
Merged
nielslyngsoe merged 24 commits intov15/devfrom Jan 31, 2025
Merged
Conversation
| </body>`; | ||
|
|
||
| popup.document.open(); | ||
| popup.document.write(html); |
Check failure
Code scanning / CodeQL
Client-side cross-site scripting
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 year ago
To fix the cross-site scripting vulnerability, we need to ensure that the window.location.href value is properly sanitized or encoded before it is used in the html string. The best way to do this is to use a library that provides functions for escaping HTML content.
In this case, we can use the DOMPurify library to sanitize the window.location.href value. This library is well-known and widely used for preventing cross-site scripting attacks.
- Install the
DOMPurifylibrary. - Import the
DOMPurifylibrary in the file. - Use
DOMPurify.sanitizeto sanitize thewindow.location.hrefvalue before including it in thehtmlstring.
Suggested changeset
1
src/Umbraco.Web.UI.Client/src/packages/media/media/url/info-app/media-links-workspace-info-app.element.ts
| @@ -4,2 +4,3 @@ | ||
| import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; | ||
| import DOMPurify from 'dompurify'; | ||
|
|
||
| @@ -46,3 +47,3 @@ | ||
| <img src="${imagePath}"/> | ||
| <script>history.pushState(null, null, "${window.location.href}");</script> | ||
| <script>history.pushState(null, null, "${DOMPurify.sanitize(window.location.href)}");</script> | ||
| </body>`; |
Copilot is powered by AI and may make mistakes. Always verify output.
nielslyngsoe
approved these changes
Jan 31, 2025
This was referenced Sep 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a new extension point called "workspaceInfoApp," allowing the addition of new apps to the info workspace view. It also turns the links-, references-, and audit log-boxes for documents and media into extensions.
Fixes #16687